
package com.rx.mgt.service;  

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rx.mgt.dao.UserGroupMappingDao;
import com.rx.mgt.domain.UserGroupMapping;

/** 
 * ClassName:UserGroupMappingService 
 * Function :
 * Reason   : 
 * Date     :Feb 4, 2017 1:49:36 PM 
 * @author   luolei 
 * @since    JDK 1.6
 */
@Service
public class UserGroupMappingService {
    @Autowired
    UserGroupMappingDao userGroupMappingDao;
    public UserGroupMapping get(Long id){
        return userGroupMappingDao.get(id);
    }
    public void  delete(Long id){
        userGroupMappingDao.delete(userGroupMappingDao.get(id));
    }
    public void saveOrUpdate(UserGroupMapping userGroupMapping){
        if(userGroupMapping.getId()!=null&&userGroupMapping.getId()>0){
            UserGroupMapping mapping = userGroupMappingDao.get(userGroupMapping.getId());
            if(mapping!=null){
                userGroupMappingDao.update(mapping);
            } else{
                userGroupMappingDao.save(userGroupMapping);
            }
        }else{
            userGroupMappingDao.save(userGroupMapping);
        }
    }
    public List<UserGroupMapping> getUserGroupMappingByGropuId(Long groupId){
        return userGroupMappingDao.getUserGroupMappingByGropuId(groupId);
    }
}
  